import 'package:flutter/material.dart';
///zhudaihao
///2024-1-30
/// 水波纹效果 widget
class RippleBackground extends StatelessWidget {
  final Color? color;
  final EdgeInsetsGeometry? padding;
  final double? circular;
  final Function? onClick;
  final Widget? child;

  const RippleBackground(
      {Key? key,
      this.color = Colors.white,
      this.padding,
      this.circular,
      this.onClick,
      this.child})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: padding == null ? const EdgeInsets.all(16) : padding!,
      child: Material(
        color: Colors.transparent,
        child: Ink(
          decoration: BoxDecoration(
            borderRadius:
                BorderRadius.circular(circular == null ? 24 : circular!),
            color: color,
          ),
          child: InkWell(
            borderRadius:
                BorderRadius.circular(circular == null ? 24 : circular!),
            child: child,
            onTap: () {
              if (onClick != null) {
                onClick!();
              }
            },
          ),
        ),
      ),
    );
  }
}
